package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2023-11-13
 * Time: 16:51
 */
class Animal{
    public String name;
    public int age;

    static {
        System.out.println("Animal静态代码块");
    }
    {
        System.out.println("Animal构造代码块");
    }
    public Animal() {
        System.out.println("不带参数的构造方法：Animal");
    }
    public Animal(String name, int age){
        this.name = name;
        this.age = age;
    }
    public void eat() {
        System.out.println(this.name+"正在吃饭");
    }
}

class Dog extends Animal{
    String fad;
    static {
        System.out.println("Dog 静态代码块");
    }
    {
        System.out.println("Dog构造代码块");
    }
    public Dog(){
        System.out.println("不带参数Dog");
    }
    public Dog(String name, int age, String fad){
        super(name, age);
        this.fad = fad;
    }
    public void bark(){
        System.out.println(this.name+ "wangwangwang");
    }

}
public class Test1 {
    public static void main1(String[] args) {
        final int a;
        a = 100;
        System.out.println(a);
    }

    public static void main(String[] args) {
        Dog dog = new Dog();
        System.out.println("==============");
        Dog dog2 = new Dog();
    }


}
